//@author A0087191Y
package net.mysoc.w111j.service.actions;

import net.mysoc.w111j.model.Money;
import net.mysoc.w111j.model.User;

/**
 * An {@code Action} to undo a budget change.
 */
public class ChangeBudgetAction implements Action {
    private final User user;
    private final Money oldBudget;
    private String status;

    public ChangeBudgetAction(User user, Money oldBudget) {
        this.user = user;
        this.oldBudget = oldBudget;
        setStatus();
    }

    @Override
    public void undo() {
        user.setBudget(oldBudget);
    }

    private void setStatus() {
        status = "Budget changed.";
    }

    @Override
    public String getStatus() {
        return status;
    }
}
